﻿/****************************** Module Header ******************************\
 * Module Name:  ExMethodForWebBrowser.cs
 * Module Version:  1.0.0 (2012-11-24)
 * Copyright (c) AnyEB.Com (14507247@qq.com)
 * 
 * This class is used for ExMethodForWebBrowser. 
 * 
 * This source is subject to the GPL License.
 * See http://www.gnu.org/licenses/gpl.html.
 * All other rights reserved.
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UCF.Core.Forms
{
    public static class ExMethodForWebBrowser
    {
        public static void LoadBody(this WebBrowser wb, string v, bool isReadOnly = false)
        {
            wb.DocumentText = string.Format("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title></title><style type=\"text/css\">body {{ margin:0px;font-size:12px;}}</style></head><body{1}>{0}</body></html>", v, isReadOnly ? " oncontextmenu=\"window.event.returnValue=false;\" onselectstart=\"return false;\"" : string.Empty);
        }
    }
}
